//
//  YYSuperStudent.m
//  Pthread
//
//  Created by Yanyan Jiang on 2023/3/15.
//  Copyright © 2023 Yanyan Jiang. All rights reserved.
//

#import "YYSuperStudent.h"


@implementation YYSuperStudent



- (instancetype)init{
    if(self=[super init]){
        [self class];
        [self superclass];
        
        [super class];
        [super superclass];
    }
    return self;
}


- (void)run{
    
    //super调用的receiver仍然是YYSuperStudent对象
    [super run];
    NSLog(@"%s",__func__);
    
    // struct objc_super arg = {self,[MJPerson class]};
    // objc_msgSendSuper(arg,@selector(run))
}


- (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector{
    //本来能调用的方法
    if([self respondsToSelector:aSelector]){
        return [super methodSignatureForSelector:aSelector];
    }
    //找不到的方法
    return [NSMethodSignature signatureWithObjCTypes:"v16@0:8"];
    
}

//找不到的方法，都会来到这里
- (void)forwardInvocation:(NSInvocation *)anInvocation{
    NSLog(@"方法找不到%@方法",NSStringFromSelector(anInvocation.selector));
}

@end
